home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / dbImporter.cpt / dbImporter / card_2840.txt < prev    next >
Text File  |  1989-02-26  |  7KB  |  266 lines

  1. -- card: 2840 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 2586
  5. -- name: 
  6. ----- HyperTalk script -----
  7. on openCard
  8.   hide message
  9. end openCard
  10.  
  11.  
  12. -- part 3 (button)
  13. -- low flags: 00
  14. -- high flags: 8006
  15. -- rect: left=287 top=29 right=51 bottom=451
  16. -- title width / last selected line: 0
  17. -- icon id / first selected line: 0 / 0
  18. -- text alignment: 1
  19. -- font id: 0
  20. -- text size: 12
  21. -- style flags: 0
  22. -- line height: 16
  23. -- part name: Set Field Names
  24. ----- HyperTalk script -----
  25. --prepare text data file with field headers (names) separated by tabs
  26. --to use this button, prepare at least as many card background fields
  27. --as fields separated by tabs of your text data file
  28. --    by Ted Tripp, 4588 CR 523, Bayfield, CO 81122, 303-884-9029
  29. on mouseUp
  30.   ask "Set field names from which file?"
  31.   if it is empty then exit mouseUp
  32.   put it into fileName
  33.   open file fileName
  34.   read from file fileName until return --get field headers
  35.   if it is empty then
  36.     close file fileName
  37.     exit mouseUp
  38.   end if
  39.   put it into fieldNames
  40.   repeat with i = 1 to the number of fields
  41.     put offset(tab,fieldNames) into num --gets characters until tab
  42.     if num is 0 then
  43.       set name of field i to fieldNames -- sets last field name, stops
  44.       put fieldNames into field i
  45.       exit repeat
  46.     end if
  47.     get char 1 to num - 1 of fieldNames
  48.     set name of field i to it
  49.     put it into field i
  50.     delete char 1 to num of fieldNames
  51.   end repeat
  52.   close file fileName
  53.   choose field tool --ready to adjust fields
  54. end mouseUp
  55.  
  56.  
  57. -- part 4 (button)
  58. -- low flags: 00
  59. -- high flags: 0000
  60. -- rect: left=231 top=31 right=70 bottom=272
  61. -- title width / last selected line: 0
  62. -- icon id / first selected line: 19678 / 19678
  63. -- text alignment: 1
  64. -- font id: 0
  65. -- text size: 12
  66. -- style flags: 0
  67. -- line height: 16
  68. -- part name: Tell Me About...
  69. ----- HyperTalk script -----
  70. on mouseUp
  71.   go to card "About‚Ķ"
  72. end mouseUp
  73.  
  74.  
  75. -- part 9 (button)
  76. -- low flags: 00
  77. -- high flags: 8006
  78. -- rect: left=287 top=52 right=74 bottom=451
  79. -- title width / last selected line: 0
  80. -- icon id / first selected line: 0 / 0
  81. -- text alignment: 1
  82. -- font id: 0
  83. -- text size: 12
  84. -- style flags: 0
  85. -- line height: 16
  86. -- part name: Import database
  87. ----- HyperTalk script -----
  88. --to use this button, prepare at least as many HC background fields
  89. --as fields separated by tabs of your text data file
  90. --    by Ted Tripp, 4588 CR 523, Bayfield, CO 81122, 303-884-9029
  91. on mouseUp
  92.   ask "Import text from which file?"
  93.   if it is empty then exit mouseUp
  94.   put it into fileName
  95.   open file fileName
  96.   set cursor to 4
  97.   repeat
  98.     read from file fileName until return -- get first record
  99.     if it is empty then
  100.       doMenu "Delete Card"
  101.       close file fileName
  102.       exit mouseUp
  103.     end if
  104.     put it into data
  105.     repeat with i = 1 to the number of fields
  106.       put offset(tab,data) into num --gets first field (until tab)
  107.       if num is 0 then -- last field of record has no tab
  108.         put data into field i -- writes last field
  109.         delete last char of field i -- deletes return char
  110.         if first char of field i is quote and last char of field i is quote then --deletes quote marks
  111.           delete first char of field i
  112.           delete last char of field i
  113.         end if
  114.         exit repeat -- stops
  115.       end if
  116.       put char 1 to (num - 1) of data into field i -- writes first field
  117.       repeat while last char of field i is tab -- pesky ASCII 9!
  118.         delete last char of field i
  119.       end repeat
  120.       if first char of field i is quote and last char of field i is quote then --deletes quote marks
  121.         delete first char of field i
  122.         delete last char of field i
  123.       end if
  124.       delete char 1 to num of data -- gets rid of field
  125.     end repeat
  126.     doMenu "New Card"
  127.   end repeat
  128.   close file fileName
  129.   set cursor to 1
  130. end mouseUp
  131.  
  132.  
  133.  
  134. -- part 11 (button)
  135. -- low flags: 00
  136. -- high flags: 8003
  137. -- rect: left=350 top=301 right=323 bottom=431
  138. -- title width / last selected line: 0
  139. -- icon id / first selected line: 0 / 0
  140. -- text alignment: 1
  141. -- font id: 0
  142. -- text size: 12
  143. -- style flags: 0
  144. -- line height: 16
  145. -- part name: Field fixer
  146. ----- HyperTalk script -----
  147. --because the import script encountering an empty field sometimes lets
  148. --an invisible tab or return character slip into the hc field, or the
  149. --user accidentally puts a return character into a text field,
  150. --when the hc database is exported it is all screwed up! So, this script
  151. --fixes up the hc database for export.
  152.  
  153. on mouseUp
  154.   set cursor to 4
  155.   put the name of this bkgnd into bakground
  156.   go to first card of bkgnd bakground
  157.   repeat for the number of cards
  158.     get the name of this bkgnd
  159.     if it is not bakground then exit repeat
  160.     repeat with i = 1 to the number of fields
  161.       get last char of field i
  162.       if it is tab then put empty into last char of field i
  163.       repeat while last char of field i is return
  164.         get last char of field i
  165.         if it is return then
  166.           put empty into last char of field i
  167.         end if
  168.       end repeat
  169.       repeat while offset(return,field i) is not 0
  170.         get offset(return,field i)
  171.         put space & "*" & space into char it of field i
  172.       end repeat
  173.     end repeat
  174.     go next card
  175.   end repeat
  176. end mouseUp
  177.  
  178.  
  179. -- part 12 (button)
  180. -- low flags: 00
  181. -- high flags: 8003
  182. -- rect: left=60 top=301 right=323 bottom=184
  183. -- title width / last selected line: 0
  184. -- icon id / first selected line: 0 / 0
  185. -- text alignment: 1
  186. -- font id: 0
  187. -- text size: 12
  188. -- style flags: 0
  189. -- line height: 16
  190. -- part name: Export database
  191. ----- HyperTalk script -----
  192. on mouseUp
  193.   put the short name of this stack & ".text" into fileName
  194.   ask "Export text to what file?" with fileName
  195.   if it is empty then exit mouseUp
  196.   put it into fileName
  197.   open file fileName
  198.   set cursor to 4
  199.   put the name of this bkgnd into bakground
  200.   go to first card of bkgnd bakground
  201.   repeat for the number of cards
  202.     get the name of this bkgnd
  203.     if it is not bakground then exit repeat
  204.     repeat with i = 1 to the number of fields
  205.       write field i & tab to file fileName
  206.     end repeat
  207.     write return to file fileName
  208.     go to next card
  209.   end repeat
  210.   close file fileName
  211.   set cursor to 1
  212. end mouseUp
  213.  
  214.  
  215.  
  216. -- part contents for background part 1
  217. ----- text -----
  218. database Importer
  219.  
  220. -- part contents for background part 25
  221. ----- text -----
  222. Field 2
  223.  
  224. -- part contents for background part 26
  225. ----- text -----
  226. Field 3
  227.  
  228. -- part contents for background part 27
  229. ----- text -----
  230. Field 4
  231.  
  232. -- part contents for background part 28
  233. ----- text -----
  234. Field 5
  235.  
  236. -- part contents for background part 29
  237. ----- text -----
  238. Field 6
  239.  
  240. -- part contents for background part 30
  241. ----- text -----
  242. Field 7
  243.  
  244. -- part contents for background part 31
  245. ----- text -----
  246. Field 8
  247.  
  248. -- part contents for background part 32
  249. ----- text -----
  250. Field 9
  251.  
  252. -- part contents for background part 33
  253. ----- text -----
  254. Field Ten
  255.  
  256. -- part contents for background part 34
  257. ----- text -----
  258. Field  Eleven
  259.  
  260. -- part contents for background part 35
  261. ----- text -----
  262. Field Twelve
  263.  
  264. -- part contents for background part 36
  265. ----- text -----
  266. Field Thirteen